﻿using UnityEngine;
using System.Collections;
[CreateAssetMenu(fileName = "NewBallData", menuName = "MyAsset/CreateBallData", order = 0)]
public class BallData : ScriptableObject
{
    [Range(1f, 20f)]
    public float Mass = 1.5f;
    [Range(1f, 100f)]
    public float MovePower = 4.5f;
    [Range(1f, 120f)]
    public float JumpImpulse = 6f;
    [Range(0f, 1f)]
    public float Bouncness = 0.7f;    
    [Range(0.02f, 2f)]
    public float AngularDrag = 0.05f;
    [Range(0.02f, 2f)]
    public float MoveDrag = 0.15f;
    [Range(1f, 200f)]
    public float BrakePower = 12.5f;
    [Range(0, 31)]
    public int Layer;
    public Color BallColor;
    //public Material BallMaterial;
    public static void Lerp(BallData from, BallData to, BallData result, float t)
    {      
        result.Mass = Mathf.Lerp(from.Mass, to.Mass, t);
        result.MovePower = Mathf.Lerp(from.MovePower, to.MovePower, t);
        result.JumpImpulse = Mathf.Lerp(from.JumpImpulse, to.JumpImpulse, t);
        result.Bouncness = Mathf.Lerp(from.Bouncness, to.Bouncness, t);
        result.AngularDrag = Mathf.Lerp(from.AngularDrag, to.AngularDrag, t);
        result.MoveDrag = Mathf.Lerp(from.MoveDrag, to.MoveDrag, t);
        result.BrakePower = Mathf.Lerp(from.BrakePower, to.BrakePower, t);
        result.BallColor = Color.Lerp(from.BallColor, to.BallColor, t);
    }
}
